﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable disable

namespace RazorAdmin.Models
{
    public partial class salerContext : DbContext
    {
        public salerContext()
        {
        }

        public salerContext(DbContextOptions<salerContext> options)
            : base(options)
        {
        }

        public virtual DbSet<TBind> TBinds { get; set; }
        public virtual DbSet<TPlayerCash> TPlayerCashes { get; set; }
        public virtual DbSet<TSaler> TSalers { get; set; }
        public virtual DbSet<TSalerCash> TSalerCashes { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseSqlServer("Server=127.0.0.1;Database=saler;User Id=sa;Password=sa;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("Relational:Collation", "Chinese_PRC_CI_AS");

            modelBuilder.Entity<TBind>(entity =>
            {
                entity.ToTable("t_bind");

                entity.HasIndex(e => e.Playerid, "UQ__t_bind__2CD71478117F9D94")
                    .IsUnique();

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Playerid)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("playerid");

                entity.Property(e => e.Playernick)
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("playernick");

                entity.Property(e => e.Salerid)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("salerid");
            });

            modelBuilder.Entity<TPlayerCash>(entity =>
            {
                entity.ToTable("t_playerCash");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Dates)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.PlayerCash)
                    .HasColumnType("smallmoney")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.Playerid)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("playerid");

                entity.Property(e => e.Salerid)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("salerid");
            });

            modelBuilder.Entity<TSaler>(entity =>
            {
                entity.HasKey(e => e.Salerid)
                    .HasName("PK__t_saler__E35E6FCE540C7B00");

                entity.ToTable("t_saler");

                entity.Property(e => e.Salerid)
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("salerid");

                entity.Property(e => e.MaxSub)
                    .HasColumnName("max_sub")
                    .HasDefaultValueSql("((5))");

                entity.Property(e => e.Nickname)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("nickname");

                entity.Property(e => e.QxOpenagent)
                    .HasColumnName("qx_openagent")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.QxTgsp)
                    .HasColumnName("qx_tgsp")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.QxTxsp)
                    .HasColumnName("qx_txsp")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.RealName)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("real_name");

                entity.Property(e => e.SalerPwd)
                    .HasMaxLength(128)
                    .IsUnicode(false)
                    .HasColumnName("salerPwd");

                entity.Property(e => e.Sid)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("sid");

                entity.Property(e => e.StateN)
                    .HasColumnName("state_n")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.SuperiorId)
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("superior_id");

                entity.Property(e => e.TimeLogin)
                    .HasColumnType("datetime")
                    .HasColumnName("time_login");

                entity.Property(e => e.TimeReg)
                    .HasColumnType("datetime")
                    .HasColumnName("time_reg")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.TotalCash)
                    .HasColumnType("money")
                    .HasColumnName("total_cash")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.TxCash)
                    .HasColumnType("smallmoney")
                    .HasColumnName("tx_cash")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.TxPwd)
                    .HasMaxLength(128)
                    .IsUnicode(false)
                    .HasColumnName("tx_pwd");

                entity.Property(e => e.WxId)
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("wx_id");

                entity.Property(e => e.WxOpenid)
                    .HasMaxLength(128)
                    .IsUnicode(false)
                    .HasColumnName("wx_openid");

                entity.Property(e => e.WxUnionid)
                    .HasMaxLength(128)
                    .IsUnicode(false)
                    .HasColumnName("wx_unionid");
            });

            modelBuilder.Entity<TSalerCash>(entity =>
            {
                entity.ToTable("t_salerCash");

                entity.Property(e => e.Id).HasColumnName("id");

                entity.Property(e => e.Dates)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Salerid)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("salerid");

                entity.Property(e => e.SubCash)
                    .HasColumnType("smallmoney")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.Subid)
                    .IsRequired()
                    .HasMaxLength(64)
                    .IsUnicode(false)
                    .HasColumnName("subid");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
